package com.resource.authoritymanage.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.resource.authoritymanage.config.AuditMeanEnum;
import com.resource.authoritymanage.config.AuditStatusEnum;
import com.resource.authoritymanage.entity.TIdentifyApplyEntity;
import com.resource.authoritymanage.entity.TIdentifyAuditEntity;
import com.resource.authoritymanage.mapper.TIdentifyAuditDao;
import com.resource.authoritymanage.service.TIdentifyAuditService;
import com.resource.common.utils.PageUtils;
import com.resource.common.utils.Query;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Set;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


@Service
public class TIdentifyAuditServiceImpl extends ServiceImpl<TIdentifyAuditDao, TIdentifyAuditEntity> implements TIdentifyAuditService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        int size = params.size();
        IPage<TIdentifyAuditEntity> page = new Page<>();
        if (size == 4) {
            String keys = "";
            String param = "";
            Set<String> strings = params.keySet();
            for (String key : strings) {
                keys = key;
                param = params.get(keys).toString();
            }
            page = this.page(
                    new Query<TIdentifyAuditEntity>().getPage(params),
                    new QueryWrapper<TIdentifyAuditEntity>().eq(keys, param)
            );
            return new PageUtils(page);
        }
        page = this.page(
                new Query<TIdentifyAuditEntity>().getPage(params),
                new QueryWrapper<TIdentifyAuditEntity>()
        );
        return new PageUtils(page);
    }

}